package com.example.petcare.mapper;

import com.example.petcare.pojo.CartItem;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CartItemMapper {


    // 查询购物车中所有的增值商品
    @Select("select * from cart_item where host_id=#{hostId}")
    List<CartItem> getCartItemsByHostId(Integer hostId);

    // 根据providerId查询price表中的price数据
    @Select("select price from price where provider_id=#{providerId}")
    Double findPriceByProviderId(Integer providerId);

    // 更新price表中的price数据
    @Update("update price set price=#{price} where provider_id=#{providerId}")
    void updatePriceByProviderId(Integer providerId, Double price);
}
